<div class="row">
    <div class="col-md-8 ng-scope">
        <div>
            <div class="grid-header clearfix" style="position:relative;">
                <span class="fl f14 lh30 text-indent">角色列表</span>
                <a class="fr btn btn-yellow"
                   ng-show="userAuthList.indexOf('1201') !== -1 || userAuthList.indexOf('0031') !== -1"
                   ui-dialog="新增角色"
                   ui-dialog-init="addNewRole($dialog, $dialogScope)"
                   ui-dialog-ok="saveNewRole($dialog, $dialogScope)"
                   ui-dialog-template="{{ addNewRoleTemplateUrl }}">
                    <i class="btn-icon-add"></i>新增角色
                </a>
                <div class="tab-bottom-line"></div>
            </div>
            <div class="grid-header row clearfix mt15"
                 ng-show="userAuthList.indexOf('1200') !== -1 || userAuthList.indexOf('0030') !== -1">
                <div class="col-md-18" style="padding-right: 0;">
                    <input type="text" name="search_for_role"
                           class="input-text fl mr5 ng-pristine ng-untouched ng-valid"
                           placeholder="角色名称"
                           ng-model="keyword"
                           style="font-size: 12px;">
                </div>
                <div class="col-md-6">
                    <span class="">
                        <a class="btn"
                           ng-click="searchRole()">
                            搜索
                        </a>
                    </span>
                </div>
            </div>
            <div class="mt15">
                <!--树状菜单-->
                <div class="tree-menu">
                    <ul>
                        <li class="tree-branch tree-branch-expand"
                            ng-repeat="item in listData">
                            <div class="tree-header" data-switch>
                                <i class="icon-fold" ng-if="item.children.length"></i>
                                <span>{{ item.name }}</span>
                            </div>
                            <ul ng-if="item.children.length">
                                <li class="tree-branch"
                                    ng-repeat="child in item.children"
                                    ng-class="{'tree-active': curRoleId == child.role_id}">
                                    <div class="tree-content" ng-click="changeItem(child)">
                                        <span>{{ child.role_name }}</span>
                                        <span class="iconbox"
                                              ng-show="userAuthList.indexOf('1201') !== -1 || userAuthList.indexOf('0031') !== -1">
                                            <i class="icon-op-edit"
                                               ui-dialog="编辑角色"
                                               ui-dialog-init="editRole($dialog, $dialogScope, child)"
                                               ui-dialog-ok="saveEditRole($dialog, $dialogScope, child)"
                                               ui-dialog-template="{{ editRoleTemplateUrl }}"></i>
                                            <i class="icon-op-del"
                                               ng-click="delRole(child, $index, item.children)"
                                               ui-dialog="删除角色"></i>
                                            <i class="icon-op-link"
                                               ui-dialog="角色关联用户({{child.role_name}})"
                                               ui-dialog-init="relateRole($dialog, $dialogScope)"
                                               ui-dialog-ok="saveRelateRole($dialog, $dialogScope)"
                                               ui-dialog-template="{{ relateRoleTemplateUrl }}"></i>
                                        </span>
                                    </div>
                                </li>
                            </ul>
                        </li>
                    </ul>
                </div>
            </div>
        </div>
    </div>
    <div class="col-md-16 ng-scope">
        <div class="grid-header clearfix" style="position: relative;">
            <span class="fl f14 lh30 text-indent">权限列表</span>
            <div class="tab-bottom-line"></div>
        </div>

        <div class="mt15 text-center" ng-repeat="item in authList">
            <div class="grid-header clearfix" style="position: relative;">
                <span class="fl f12 text-indent mr10">{{ item.name }}</span>
                <label class="checkbox fl"
                       ng-click="selectAllAction(item)">
                    <input type="checkbox" ng-model="item.checked">
                    <span>全部</span>
                </label>
            </div>
            <div class="sheet">
                <table width="100%" class="mt5">
                    <tbody>
                    <tr ng-if="item.sub.length"
                        ng-repeat="sub in item.sub">
                        <td width="100" height="34" class="bgcf2">
                            {{ sub.name }}
                        </td>
                        <td>
                            <div class="checkboxtr1 ml25 mt10 tips-list clearfix text-left">
                                <label class="checkbox" ng-repeat="action in sub.actions">
                                    <input type="checkbox"
                                           ng-change="selectCheckChange()"
                                           ng-model="action.checked">
                                    <span>{{ action.name }}</span>
                                </label>
                            </div>
                        </td>
                    </tr>
                    <tr ng-if="item.actions.length">
                        <td>
                            <div class="checkboxtr1 ml25 mt10 tips-list clearfix text-left">
                                <label class="checkbox" ng-repeat="action in item.actions">
                                    <input type="checkbox"
                                           ng-change="selectCheckChange()"
                                           ng-model="action.checked">
                                    <span>{{ action.name }}</span>
                                </label>
                            </div>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </div>
        </div>

        <div class="mt15">
            <a class="btn fr"
               ng-show="userAuthList.indexOf('1201') !== -1 || userAuthList.indexOf('0031') !== -1"
               ng-click="saveRoleAuth()">保存权限</a>
        </div>
    </div>
</div>